package com.seecen.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    private static final int CODE_SUCCESS = 200;
    private static final String MSG_SUCCESS = "操作成功";
    private static final int CODE_FAIL = 500;
    private int code;
    private String msg;
    private T data;
    public static <T> Result<T> success(T data) {
        return new Result<>(CODE_SUCCESS, MSG_SUCCESS, data);
    }
    public static <T> Result<T> success() {
        return new Result<>(CODE_SUCCESS, MSG_SUCCESS, null);
    }

    public static <T> Result<T> fail(String msg) {
        return new Result<>(CODE_FAIL, msg, null);
    }
}
